from tortoise import fields
from datetime import datetime
from .base import BaseModel, TimestampMixin


class SysConfig(BaseModel, TimestampMixin):
    """参数配置表"""

    config_id = fields.IntField(pk=True, description="参数主键")

    config_name = fields.CharField(max_length=100, null=True, description="参数名称")

    config_key = fields.CharField(max_length=100, null=True, description="参数键名")

    config_value = fields.CharField(max_length=500, null=True, description="参数键值")

    config_type = fields.CharField(max_length=1, null=True, description="系统内置（Y是 N否）")

    status = fields.CharField(max_length=1, null=True, description="状态（0正常 2删除）")

    create_by = fields.CharField(max_length=64, null=True, description="创建者")

    create_time = fields.DatetimeField(null=True, description="创建时间")

    update_by = fields.CharField(max_length=64, null=True, description="更新者")

    update_time = fields.DatetimeField(null=True, description="更新时间")

    remark = fields.CharField(max_length=500, null=True, description="备注")

    class Meta:
        table = "sys_config"

    def __str__(self):
        return f"{self.config_id}"